package de.chrisbremer.hydromap;

/**
 * @author 	chris
 * @date   	2011-12-23
 */

import java.text.SimpleDateFormat;
import java.util.Date;

import android.content.Context;

public class Hydrant {
	
	private int mId;
	private int mType;
	private int mDiameter;
	private int mPosition;
	private String mGpslat;
	private String mGpslon;
	private String mCount;
	private Boolean mSend;
	private Boolean mReceived;
	private int mRemoteid;
	private String mComment;
	private float mCapacity;
	private String mLastUpdate;
	private String mMd5sum;
	
	public Hydrant(){};
	
	public Hydrant(int Type, int Diameter, int Position, String GPSLat, String GPSLon, String Count)
	{
		
		this.mType=Type;
		this.mDiameter=Diameter;
		this.mPosition=Position;
		this.mGpslat=GPSLat;
		this.mGpslon=GPSLon;
		this.mCount = Count;
		this.mSend = false;
		this.mReceived = false;
		this.mRemoteid = 0;
	}
	public Hydrant(int HydrantID, int Type, int Diameter, int Position, String GPSLat, String GPSLon, String Count, Boolean Send, Boolean Received)
	{
		this.mId = HydrantID;
		this.mType=Type;
		this.mDiameter=Diameter;
		this.mPosition=Position;
		this.mGpslat=GPSLat;
		this.mGpslon=GPSLon;
		this.mCount = Count;
		this.mSend = Send;
		this.mReceived = Received;
		this.mRemoteid = 0;
	}
	public Hydrant(int HydrantID, int Type, int Diameter, int Position, String GPSLat, String GPSLon, String Count, Boolean Send, Boolean Received, int RemoteID)
	{
		// Dieser Kontstruktor kommt nur beim Abgleichen von externen Daten zum Einsatz, Grund: RemoteID des Servers kann hinterlegt werden!
		this.mId = HydrantID;
		this.mType=Type;
		this.mDiameter=Diameter;
		this.mPosition=Position;
		this.mGpslat=GPSLat;
		this.mGpslon=GPSLon;
		this.mCount = Count;
		this.mSend = Send;
		this.mReceived = Received;
		this.mRemoteid = RemoteID;
	}
	public Hydrant(int Type, String GPSLat, String GPSLon)
	{
		this.mType=Type;
		this.mGpslat=GPSLat;
		this.mGpslon=GPSLon;
	}
	public Hydrant getHydrById(Context con, int hydrId)
	{
		return new DatabaseHelper(con).getHydById(hydrId);
	}
	public int getID()
	{
		return this.mId;
	}
	public void SetID(int ID)
	{
		this.mId=ID;
	}
	public int getRemoteid()
	{
		return this.mRemoteid;
	}
	public void setRemoteid(int remoteid)
	{
		this.mRemoteid = remoteid;
	}
	public int getType()
	{
		return this.mType;
	}
	public void SetType(int Type)
	{
		this.mType=Type;
	}
	public int getDiameter()
	{
		return this.mDiameter;
	}
	public void setDiameter(int Diameter)
	{
		this.mDiameter=Diameter;
	}
	public int getPosition()
	{
		return this.mPosition;
	}
	public void setPosition(int Position)
	{
		this.mPosition=Position;
	}
	public String getGPSLat()
	{
		return this.mGpslat;
	}
	public void setGPSLat(String GPSLat)
	{
		this.mGpslat=GPSLat;
	}
	public String getGPSLon()
	{
		return this.mGpslon;
	}
	public void SetGPSLon(String GPSLon)
	{
		this.mGpslon=GPSLon;
	}
	public String getCount()
	{
		return this.mCount;
	}
	public void setCount(String Count)
	{
		this.mCount=Count;
	}
	public Boolean getSend()
	{
		return this.mSend;
	}
	public void setSend(Boolean send)
	{
		this.mSend = send;
	}
	public Boolean getReceived()
	{
		return this.mReceived;
	}
	public void setReceived(Boolean received)
	{
		this.mReceived = received;
	}
	public String getType(Context con, int Type)
	{
		return new DatabaseHelper(con).getType(Type);
	}
	public String getPosition(Context con, int Position)
	{
		return new DatabaseHelper(con).getPosition(Position);
	}
	public String getComment()
	{
		return this.mComment;
	}
	public void setComment(String Comment)
	{
		this.mComment = Comment;
	}
	public float getCapacity()
	{
		return this.mCapacity;
	}
	public void setCapacity(float Capacity)
	{
		this.mCapacity = Capacity;
	}
	public void setLastUpdate() {
		Date now = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		this.mLastUpdate = sdf.format(now);
	}
	public String getLastUpdate()
	{
		return this.mLastUpdate;
	}

	public String getMd5sum()
	{
		return mMd5sum;
	}

	public void setMd5sum(String Md5sum)
	{
		this.mMd5sum = Md5sum;
	}

}
